package com.example.demo.vo

import com.example.demo.dbmodels.TFoodType
import io.swagger.annotations.ApiModelProperty

class FoodTypeVo {


    @ApiModelProperty("id")
    var id: Int? = null

    @ApiModelProperty("菜品名称")
    var title: String? = null


    fun getVo(table: TFoodType): FoodTypeVo {
        table.run {
            val data = FoodTypeVo()
            data.id = this.id
            data.title = this.title
            return data
        }
    }

    fun getListVo(table: List<TFoodType>): List<FoodTypeVo> {
        table.run {
            val listFoodTypeVo = mutableListOf<FoodTypeVo>()
            this.forEach {
                val data = FoodTypeVo()
                data.id = it.id
                data.title = it.title
                listFoodTypeVo.add(data)
            }
            return listFoodTypeVo
        }
    }

}